package com.temple.common.param;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.experimental.Accessors;

import java.io.Serializable;


@Getter
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="基类的分页", description="基类的分页")
public class BasePageParam implements Serializable {

    @ApiModelProperty(value = "请求页 默认第一页")
    private Integer page = 1;

    @ApiModelProperty(value = "请求每页的数量  默认每页10条")
    private Integer limit =10;

    public BasePageParam() {
        super();
    }

    public BasePageParam(Integer page, Integer limit) {
        super();
        this.page = page;
        this.limit = limit;
    }

    public void setPage(Integer page) {
        this.page = page == null || page <1 ? 1 : page;
    }

    public void setLimit(Integer limit) {
        this.limit = limit == null || limit <0 ? 10 : limit;
    }
}
